from multiprocessing import Process,Queue

# 子进程：根据父进程指令做事
def handle(q):
    while True:
        cmd = q.get() # 获取指令
        if cmd == "+":
            print("执行加法操作")
        elif cmd =="-":
            print("执行减法操作")

def main(q):
    while True:
        cmd = input("指令：")
        if cmd == "#":
            break
        q.put(cmd)

if __name__ == '__main__':
    q = Queue(5)
    p = Process(target=handle,args={q})
    p.start()
    main(q)